package com.yuwei.module_property.adapter

import android.graphics.Color
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.yuwei.http.entity.PropertyEntityItem
import com.yuwei.module_property.R

class RegionAdapter: BaseQuickAdapter<PropertyEntityItem,BaseViewHolder>(
    R.layout.region_item
) {
    override fun convert(holder: BaseViewHolder, item: PropertyEntityItem) {
        holder.setText(R.id.region_name,item.regionName)
        holder.setText(R.id.region_enterprise_name,"企业：${item.enterpriseName}")
        holder.setText(R.id.region_area_num,"面积：${item.area}m²")
        val status = holder.getView<TextView>(R.id.region_status)
        if(item.rented){
            status.text = "已租"
            status.setTextColor(Color.parseColor("#991B1B"))
            status.setBackgroundResource(R.drawable.region_status_item_bg2)
        }else{
            status.text = "出租"
            status.setTextColor(Color.parseColor("#166534"))
            status.setBackgroundResource(R.drawable.region_status_item_bg1)
        }
    }
}